import { Injectable } from '@nestjs/common';
import * as cnchar from 'cnchar';
import 'cnchar-poly';
const cncharPoly = cnchar as any;
@Injectable()
export class AppService {
  getHello(): string {
    return 'Hello World!';
  }
  /**获取拼音 */
  getSpells(text: string) {
    const spells = cncharPoly.spell(text, 'tone') as string | string[];
    if (typeof spells === 'object') {
      return spells[0];
    }
    return spells;
  }
}
